package com.cans.web.menu;

import com.cans.dto.PageRes;
import com.cans.dto.ResDto;
import com.cans.service.pms.api.ISysMenuService;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

/**
 * description: 菜单
 * @author: cans
 * @date: 2018/4/30
 */
@Controller
@RequestMapping("/menu")
public class MenuController {

    @Resource
    private ISysMenuService menuService;

    /**
     * 跳转到列表
     * @return
     */
    @GetMapping("/toPageList")
    public String toPageList(){

        return "menu/menuList";
    }

    /**
     * 分页列表
     * @return
     */
    @GetMapping("/pageList")
    public PageRes pageList(Integer page, Integer limit){

        Pageable pageable = new PageRequest(page - 1,limit);

        return menuService.findPage(pageable);
    }
}
